#include<cstdio>
using namespace std;
const int N = 200005;
struct list {
	int he, ta, last, next, pl;
}l[N];
int n, cnt, count, a[N];
inline int read() {
	int an = 0;
	char ch = getchar();
	for (; ch < 48 || ch > 57 ; ch = getchar());
	for (; ch > 47 && ch < 58 ; ch = getchar())
		an = (an << 3) + (an << 1) + ch - 48;
	return an;
}
int main() {
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	n = read();
	a[0] = -1;
	for (int i = 1 ; i <= n ; i++) {
		a[i] = read();
		if (a[i] != a[i - 1]) {
			cnt++;
			l[cnt].pl = a[i];
			l[cnt].he = l[cnt].ta = i;
			l[cnt].last = cnt - 1;
			l[cnt - 1].next = cnt;
		}
		else l[cnt].ta = i;
	}
	int now, lastpl;
	while (count < n) {
		now = 0;lastpl = -1;
		while (l[now].next != 0) {
			if (lastpl != l[l[now].next].pl) {
				printf("%d ", l[l[now].next].he);
				l[l[now].next].he++;
				count++;
				lastpl = l[l[now].next].pl;
			}
			if (l[l[now].next].he > l[l[now].next].ta) {
				l[now].next = l[l[now].next].next;
				l[l[now].next].last = now;
			}
			else now = l[now].next;
		}
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
